<?php 
App::import('Vendor','mpdf44/mpdf');
Configure::write('debug', 0);
//limpiar página en caso de que haya una impresión innecesaria o por error
ob_start();
$html = ob_get_contents();
ob_end_clean();

//cargando objeto para crear pdf
//$mpdf = new mPDF();
//$mpdf=new mPDF('win-1252','A4','','',20,15,48,25,10,10);
if(isset(AppController::$_mpdf)){
	$mpdf = AppController::$_mpdf;
} else{
	$mpdf=new mPDF('win-1252','LEGAL','','',10,10,20,10,10,10);
	$mpdf->SetDisplayMode('fullpage');	
} 
if(defined('_HEADER_DEFAULT_')){
	$htmlheader = '<table width="100%" cellpadding="0" cellspacing="0" style="border-bottom:solid 1px #000"><tr valign="middle"><td><img src="'. $this->path_webroot .'img\\logo.jpg" width="40" style="filter: alpha(opacity=50); opacity: .5" /><b>Corporación ADC</b></td></tr></table>';
	$mpdf->SetHTMLHeader($htmlheader);
}
if(defined('_FOOTER_DEFAULT_')){
	$mpdf->SetFooter('{DATE j-m-Y H:m} '.$this->_usuario['Tercero']['razon_social'].'| |{PAGENO}/{nb}');
}

$mpdf->SetProtection(array('print'));
$mpdf->SetTitle($title_for_layout);
$mpdf->SetAuthor("ERP ADCSoft");

//reemplazando rutas de imágenes
$content_for_layout = str_replace('{path_webroot}', $this->path_webroot, $content_for_layout);

$mpdf->WriteHTML($content_for_layout);
$mpdf->Output();
exit;

?>